/****************************************************
 * 创建人:   robin
 * 创建时间: 2023/8/30.030 14:20
 * 项目名称: cpy
 * 文件名称: ServerTypeEnum.java
 * 文件描述: 
 *
 * All rights Reserved, Designed By 德品软件
 * @Copyright:2023-2023
 *
 ********************************************************/

package com.dp.enumeration;

public enum ServerTypeEnum {
    UNDEFINED(" ", " "),
    NOZZLE("0", "加油枪"),
    NOZZLE_2("2", "加油枪2"),
    OIL_TANK("1", "油罐"),
    ;
    
    ServerTypeEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }
    
    public String getCode() {
        return code;
    }
    
    public String getName() {
        return name;
    }
    
    public static ServerTypeEnum codeToEnum(String code) {
        for (ServerTypeEnum enumType : ServerTypeEnum.values()) {
            if (enumType.getCode().equals(code)) {
                return enumType;
            }
        }
        return ServerTypeEnum.UNDEFINED;
    }
    
    private String code;
    private String name;
}
